-- Fk:loadTranslationTable{
--   ["work_heg"] = "国战-工作室",
--   ["wk_heg"] = "日月",
-- }

-- local chengyu = General(extension, "wk_heg__chengyu", "wei", 3)
-- chengyu.hidden = true
-- local shefu = fk.CreateTriggerSkill{
--   name = "wk_heg__shefu",
--   anim_type = "special",
--   events = {fk.Damaged},
--   can_trigger = function (self, event, target, player, data)
--     return player:hasSkill(self) and player == target and not player:isNude()
--   end,
--   on_cost = function (self, event, target, player, data)
--     local room = player.room
--     local chooses = table.map(table.filter(room.alive_players, function (p)
--       return p ~= room.current
--     end), Util.IdMapper)
--     local tos, id = room:askForChooseCardAndPlayers(player, chooses, 1, 2, ".", "#wk_heg__shefu-choose", self.name, true)
--     if #tos ~= 0 then
--       self.cost_data = {tos, id}
--       return true
--     end
--   end,
--   on_use = function(self, event, target, player, data)
--     local room = player.room
--     local to = self.cost_data[1]
--     local id = self.cost_data[2]
--     room:throwCard({id}, self.name, player, player)
--     for i = 1, #to, 1 do
--       local too = room:getPlayerById(to[i])
--       room:setPlayerMark(too, "@@lure_tiger-turn", 1)
--       room:setPlayerMark(too, MarkEnum.PlayerRemoved .. "-turn", 1)
--       room:handleAddLoseSkills(too, "#lure_tiger_hp|#lure_tiger_prohibit", nil, false, true) -- global…
--       room.logic:trigger("fk.RemoveStateChanged", too, nil) -- FIXME
--     end
--     local targets = table.map(table.filter(room.alive_players, function (p)
--       return H.inSiegeRelation(p:getLastAlive(), p:getNextAlive(), p)
--     end), Util.IdMapper)
--     local damage_to_id = room:askForChoosePlayers(player, targets, 1, 1, "#wk_heg__shefu-choose-damage", self.name, true)
--     local damage_to = room:getPlayerById(damage_to_id[1])
--     if not player.dead and not damage_to.dead then
--       room:damage{
--         from = player,
--         to = damage_to,
--         damage = 1,
--         skillName = self.name
--       }
--     end
--   end,
-- }


-- local danli = fk.CreateTriggerSkill{
--   name = "wk_heg__danli",
--   events = {fk.EventPhaseStart},
--   anim_type = "special",
--   can_trigger = function (self, event, target, player, data)
--     return player:hasSkill(self) and player.phase == Player.Finish and player == target and H.hasGeneral(player, true)
--   end,
--   on_use = function (self, event, target, player, data)
--     local room = player.room
--     H.removeGeneral(room, player, true)
--     H.addHegMark(room, player, "companion")
--     local kingdom = H.getKingdom(player)
--     for _, p in ipairs(room:getAlivePlayers()) do
--       if p.kingdom == "unknown" and not p.dead then
--         if H.getKingdomPlayersNum(room)[kingdom] >= #room.players // 2 and not table.find(room.alive_players, function(_p) return _p.general == "ld__lordcaocao" end) then break end
--         local main, deputy = false, false
--         if H.compareExpectedKingdomWith(p, player) then
--           local general = Fk.generals[p:getMark("__heg_general")]
--           main = general.kingdom == kingdom or general.subkingdom == kingdom
--           general = Fk.generals[p:getMark("__heg_deputy")]
--           deputy = general.kingdom == kingdom or general.subkingdom == kingdom
--         end
--         H.askForRevealGenerals(room, p, self.name, main, deputy)
--       end
--     end
--     local targets = table.map(table.filter(room.alive_players, function(p) return H.compareKingdomWith(p, player) and p ~= player end), Util.IdMapper)
--     if #targets > 0 then
--       room:doIndicate(player.id, targets)
--       room:sortPlayersByAction(targets)
--       for _, pid in ipairs(targets) do
--         local p = room:getPlayerById(pid)
--         if not p.dead and H.hasGeneral(p, true) then
--           local choices = {"wk_heg__danli_remove", "Cancel"}
--           local choice = room:askForChoice(p, choices, self.name)
--           if choice ~= "Cancel" then
--             H.removeGeneral(room, p, true)
--             H.addHegMark(room, p, "companion")
--           end
--         end
--       end
--     end
--   end,
-- }

-- chengyu:addSkill(shefu)
-- chengyu:addSkill(danli)
-- Fk:loadTranslationTable{
--   ["wk_heg__chengyu"] = "程昱",
--   ["designer:wk_heg__chengyu"] = "猪",
--   ["wk_heg__shefu"] = "设伏",
--   [":wk_heg__shefu"] = "当你受到伤害后，你可调离至多两名非当前回合角色，然后你可对一名被围攻的角色造成1点伤害。",
--   ["wk_heg__danli"] = "胆戾",
--   [":wk_heg__danli"] = "结束阶段，你可移除副将并获得一个“珠联璧合”标记，然后你发起势力召唤，且与你势力相同的角色可依次移除副将并获得一个“珠联璧合”标记。",

--   ["#wk_heg__shefu-choose"] = "设伏：你可弃置一张牌，调离至多两名非当前回合角色",
--   ["#wk_heg__shefu-choose-damage"] = "设伏：你可对一名被围攻的角色造成1点伤害",
--   ["wk_heg__danli_remove"] = "移除副将并获得一个“珠联璧合”标记",

--   ["#wk_heg__shefu_viewas"] = "设伏",

--   ["$wk_heg__shefu1"] = "圈套已设，埋伏已完，只等敌军进来。",
--   ["$wk_heg__shefu2"] = "如此天网，谅你插翅也难逃。",
--   ["$wk_heg__danli1"] = "曹公智略乃上天所授。",
--   ["$wk_heg__danli2"] = "天下大乱，群雄并起，必有命世。",

--   ["~wk_heg__chengyu"] = "此诚报效国家之时，吾却休矣…",
-- }


-- local wangji = General(extension, "wk_heg__wangji", "wei", 3, 3, General.Male)
-- wangji.hidden = true
-- local qizhi = fk.CreateTriggerSkill{
--   name = "wk_heg__qizhi",
--   anim_type = "offensive",
--   events = {fk.Damage},
--   can_trigger = function(self, event, target, player, data)
--     if not (player:hasSkill(self) and target == player.room.current and H.compareKingdomWith(player, target)) then return false end
--     local room = player.room
--     local damage_event = room.logic:getCurrentEvent()
--     if not damage_event then return false end
--     local x = target:getMark("wk_heg__qizhi-turn")
--     if x == 0 then
--       room.logic:getEventsOfScope(GameEvent.ChangeHp, 1, function (e)
--         local reason = e.data[3]
--         if reason == "damage" then
--           local first_damage_event = e:findParent(GameEvent.Damage)
--           if first_damage_event and first_damage_event.data[1].from == target then
--             x = first_damage_event.id
--             room:setPlayerMark(target, "wk_heg__qizhi-turn", x)
--             return true
--           end
--         end
--       end, Player.HistoryTurn)
--     end
--     return damage_event.id == x
--   end,
--   on_cost = function(self, event, target, player, data)
--     local room = player.room
--     local targets = table.map(table.filter(room.alive_players, function(p) return p ~= data.to and not p:isNude() end), Util.IdMapper)
--     local to = room:askForChoosePlayers(player, targets, 1, 1, "#wk_heg__qizhi-choose", self.name, true)
--     if #to > 0 then
--       self.cost_data = to[1]
--       return true
--     end
--   end,
--   on_use = function (self, event, target, player, data)
--     local room = player.room
--     if self.cost_data then
--       local to = room:getPlayerById(self.cost_data)
--       local id = room:askForCardChosen(player, to, "he", self.name)
--       room:throwCard(id, self.name, to, player)
--       if not to.dead then
--         to:drawCards(1, self.name)
--       end
--     end
--   end,
-- }

-- local jinqu = fk.CreateTriggerSkill{
--   name = "wk_heg__jinqu",
--   anim_type = "drwacard",
--   events = {fk.AfterCardsMove},
--   can_trigger = function(self, event, target, player, data)
--     if player:hasSkill(self) and player:usedSkillTimes(self.name, Player.HistoryTurn) == 0  then
--       for _, move in ipairs(data) do
--         if move.from == player.id and move.moveReason ~= fk.ReasonUse and move.moveReason ~= fk.ReasonResonpse then
--           for _, info in ipairs(move.moveInfo) do
--             if info.fromArea == Card.PlayerHand or info.fromArea == Card.PlayerEquip then
--               return true
--             end
--           end
--         end
--       end
--     end
--   end,
--   on_cost = function(self, event, target, player, data)
--     local room = player.room
--     local targets = table.map(table.filter(room.alive_players, function(p) return H.compareKingdomWith(p, player) end), Util.IdMapper)
--     if #targets == 0 then return end
--     local to = room:askForChoosePlayers(player, targets, 1, 1, "#wk_heg__jinqu-choose", self.name, true)
--     if #to > 0 then
--       self.cost_data = to[1]
--       return true
--     end
--   end,
--   on_use = function(self, event, target, player, data)
--     local room = player.room
--     if self.cost_data then
--       local to = room:getPlayerById(self.cost_data)
--       to:drawCards(2, self.name)
--       local turn_event = room.logic:getCurrentEvent():findParent(GameEvent.Turn, false)
--       if turn_event == nil then return false end
--       local end_id = turn_event.id
--       local cards = {}
--       U.getEventsByRule(room, GameEvent.MoveCards, 1, function (e)
--         for _, move in ipairs(e.data) do
--           if move.toArea == Card.DiscardPile then
--             for _, info in ipairs(move.moveInfo) do
--               local card_suit = Fk:getCardById(info.cardId, true).suit
--               if room:getCardArea(info.cardId) == Card.DiscardPile and not table.contains(cards, card_suit) and card_suit ~= 0 then
--                 table.insertIfNeed(cards, card_suit)
--               end
--             end
--           end
--         end
--         return false
--       end, end_id)
--       local discard_num = to:getHandcardNum() - #cards
--       if discard_num > 0 then
--         room:askForDiscard(to, discard_num, discard_num, false, self.name, false)
--       end
--     end
--   end,
-- }

-- wangji:addSkill(qizhi)
-- wangji:addSkill(jinqu)
-- Fk:loadTranslationTable{
--   ["wk_heg__wangji"] = "王基", --魏国
--   ["designer:wk_heg__wangji"] = "教父",
--   ["wk_heg__qizhi"] = "奇制",
--   [":wk_heg__qizhi"] = "与你势力相同的角色于其回合内首次造成伤害后，你可以弃置不为受伤角色的一张牌，然后以此法失去牌的角色摸一张牌。",
--   ["wk_heg__jinqu"] = "进趋",
--   [":wk_heg__jinqu"] = "每回合限一次，当你不因使用或打出而失去牌后，你可令一名与你势力相同的角色摸两张牌，然后其将手牌弃至X张（X为此回合进入弃牌堆的牌花色数）。",

--   ["#wk_heg__qizhi-choose"] = "奇制：选择一名除受伤角色外的角色，弃置其一张牌",
--   ["#wk_heg__jinqu-choose"] = "进趋：选择一名与你势力相同的角色，令其摸两张牌",

--   ["$wk_heg__qizhi1"] = "声东击西，敌寇一网成擒。",
--   ["$wk_heg__qizhi2"] = "吾意不在此地，已遣别部出发。",
--   ["$wk_heg__jinqu1"] = "建上昶水城，以逼夏口！",
--   ["$wk_heg__jinqu2"] = "通川聚粮，伐吴之业，当步步为营。",
--   ["~wk_heg__wangji"] = "天下之势，必归大魏，可恨，未能得见呐！",
-- }


-- -- 封锁 判定区
-- local heg_judge_forbidden = fk.CreateTriggerSkill{
--   name = "#heg_judge_forbidden",
--   anim_type = "control",
--   events = {fk.EventPhaseStart},
--   frequency = Skill.Compulsory,
--   can_trigger = function (self, event, target, player, data)
--     return player:getMark("@@heg_judge_forbidden") ~= 0 and player == target and player.phase == Player.Judge
--   end,
--   on_use = Util.TrueFunc,
-- }

-- -- 封锁 手牌区
-- local heg_hand_forbidden = fk.CreateTriggerSkill{
--   name = "#heg_hand_forbidden",
--   anim_type = "control",
--   events = {fk.CardUsing},
--   frequency = Skill.Compulsory,
--   can_trigger = function (self, event, target, player, data)
--     return player:getMark("@@heg_hand_forbidden") ~= 0 and player == target
--   end,
--   on_use = function (self, event, target, player, data)
--     data.toCard = nil
--     data.tos = {}
--   end,
-- }

-- -- 封锁 装备区
-- local heg_equip_forbidden = fk.CreateInvaliditySkill {
--   name = "#heg_equip_forbidden",
--   global = true,
--   invalidity_func = function(self, from, skill)
--     if from:getMark("@@heg_equip_forbidden") > 0 and skill.attached_equip then
--       for _, card in ipairs(Fk.cards) do
--         if card.type == Card.TypeEquip and skill.attached_equip == card.name then
--           return true
--         end
--       end
--     end
--   end
-- }

-- Fk:loadTranslationTable{
--   ["heg_judge_forbidden"] = "封锁 判定区",
--   ["heg_hand_forbidden"] = "封锁 手牌区",
--   ["heg_equip_forbidden"] = "封锁 装备区",

--   ["@@heg_judge_forbidden"] = "封锁 判定区",
--   ["@@heg_hand_forbidden"] = "封锁 手牌区",
--   ["@@heg_equip_forbidden"] = "封锁 装备区",

--   ["heg_judge_recover"] = "恢复 判定区",
--   ["heg_hand_recover"] = "恢复 手牌区",
--   ["heg_equip_recover"] = "恢复 装备区",

--   ["#heg_equip_forbidden"] = "封锁",
--   ["#heg_hand_forbidden"] = "封锁",
--   ["#heg_judge_forbidden"] = "封锁",
-- }

-- -- local lihui = General(extension, "wk_heg__lihui", "shu", 3)
-- -- local ziqi = fk.CreateTriggerSkill{
-- --   name = "wk_heg__ziqi",
-- --   anim_type = "offensive",
-- --   events = {fk.EventPhaseStart},
-- --   can_trigger = function (self, event, target, player, data)
-- --     return player:hasSkill(self) and H.compareKingdomWith(player, target) and target.phase == Player.Start
-- --       and (player:getMark("@@heg_judge_forbidden") == 0 or player:getMark("@@heg_equip_forbidden") == 0 or player:getMark("@@heg_hand_forbidden") == 0)
-- --   end,
-- --   on_use = function (self, event, target, player, data)
-- --     local room = player.room
-- --     local choices = {}
-- --     if player:getMark("@@heg_judge_forbidden") == 0 then
-- --       table.insert(choices, "heg_judge_forbidden")
-- --     end
-- --     if player:getMark("@@heg_hand_forbidden") == 0 then
-- --       table.insert(choices, "heg_hand_forbidden")
-- --     end
-- --     if player:getMark("@@heg_equip_forbidden") == 0 then
-- --       table.insert(choices, "heg_equip_forbidden")
-- --     end
-- --     local choice = room:askForChoice(player, choices, self.name)
-- --     room:setPlayerMark(player, "wk_heg__ziqi_forbidden", 1)
-- --     if choice == "heg_judge_forbidden" then
-- --       room:setPlayerMark(player, "wk_heg__ziqi_judge-turn", 1)
-- --       room:setPlayerMark(player, "@@heg_judge_forbidden", 1)
-- --     elseif choice == "heg_hand_forbidden" then
-- --       room:setPlayerMark(player, "wk_heg__ziqi_hand-turn", 1)
-- --       room:setPlayerMark(player, "@@heg_hand_forbidden", 1)
-- --     else
-- --       room:setPlayerMark(player, "wk_heg__ziqi_equip-turn", 1)
-- --       room:setPlayerMark(player, "@@heg_equip_forbidden", 1)
-- --     end
-- --   end,

-- --   refresh_events = {fk.TurnStart, fk.BuryVictim},
-- --   can_refresh = function (self, event, target, player, data)
-- --     return player:getMark("wk_heg__ziqi_forbidden") > 0 and target == player
-- --   end,
-- --   on_refresh = function (self, event, target, player, data)
-- --     local room = player.room
-- --     room:setPlayerMark(player, "wk_heg__ziqi_forbidden", 0)
-- --     room:setPlayerMark(player, "@@heg_judge_forbidden", 0)
-- --     room:setPlayerMark(player, "@@heg_hand_forbidden", 0)
-- --     room:setPlayerMark(player, "@@heg_equip_forbidden", 0)
-- --     room.logic:trigger("fk.RecoverRegion", player, nil)
-- --   end
-- -- }

-- -- local ziqi_trigger = fk.CreateTriggerSkill{
-- --   name = "#wk_heg__ziqi_trigger",
-- --   anim_type = "offensive",
-- --   events = {fk.Damage},
-- --   can_trigger = function (self, event, target, player, data)
-- --     return target and target == player.room.current and not H.compareKingdomWith(data.to, target) and player:usedSkillTimes(ziqi.name, Player.HistoryTurn) == 1
-- --   end,
-- --   on_cost = Util.TrueFunc,
-- --   on_use = function (self, event, target, player, data)
-- --     if player:getMark("wk_heg__ziqi_judge-turn") == 1 then
-- --       player.room:setPlayerMark(data.to, "@@heg_judge_forbidden", 1)
-- --     end
-- --     if player:getMark("wk_heg__ziqi_hand-turn") == 1 then
-- --       player.room:setPlayerMark(data.to, "@@heg_hand_forbidden", 1)
-- --     end
-- --     if player:getMark("wk_heg__ziqi_equip-turn") == 1 then
-- --       player.room:setPlayerMark(data.to, "@@heg_equip_forbidden", 1)
-- --     end
-- --   end
-- -- }

-- -- ziqi:addRelatedSkill(ziqi_trigger)
-- -- ziqi:addRelatedSkill(heg_hand_forbidden)
-- -- ziqi:addRelatedSkill(heg_judge_forbidden)
-- -- ziqi:addRelatedSkill(heg_equip_forbidden)

-- -- local xingzhang = fk.CreateTriggerSkill{
-- --   name = "wk_heg__xingzhang",
-- --   anim_type = "control",
-- --   events = {"fk.AfterCommandUse", "fk.RecoverRegion", fk.AfterDying},
-- --   frequency = Skill.Compulsory,
-- --   can_trigger = function (self, event, target, player, data)
-- --     if not (player:hasSkill(self) and player:inMyAttackRange(target)) then return false end
-- --     if event == "fk.AfterCommandUse" then
-- --       return not target:isKongcheng()
-- --     elseif event == "fk.RecoverRegion" then
-- --       return true
-- --     else
-- --       return not target.dead
-- --     end
-- --   end,
-- --   on_use = function (self, event, target, player, data)
-- --     local room = player.room
-- --     if event == "fk.AfterCommandUse" then
-- --       local card = room:askForCard(target, 1, 1, false, self.name, false)
-- --       room:moveCardTo(card, Player.Hand, player, fk.ReasonGive, self.name, nil, false, player.id)
-- --       if not target.dead then
-- --         room:recover({
-- --           who = target,
-- --           num = 1,
-- --           recoverBy = player,
-- --           skillName = self.name,
-- --         })
-- --       end
-- --     elseif event == fk.AfterDying then
-- --       local choices = {}
-- --       if target:getMark("@@heg_judge_forbidden") ~= 0 then
-- --         table.insert(choices, "heg_judge_recover")
-- --       end
-- --       if target:getMark("@@heg_hand_forbidden") ~= 0 then
-- --         table.insert(choices, "heg_hand_recover")
-- --       end
-- --       if target:getMark("@@heg_equip_forbidden") ~= 0 then
-- --         table.insert(choices, "heg_equip_recover")
-- --       end
-- --       if #choices == 0 then return false end
-- --       local choice = room:askForChoice(target, choices, self.name)
-- --       if choice == "heg_judge_forbidden" then
-- --         room:setPlayerMark(target, "@@heg_judge_forbidden", 0)
-- --       elseif choice == "heg_hand_forbidden" then
-- --         room:setPlayerMark(target, "@@heg_hand_forbidden", 0)
-- --       else
-- --         room:setPlayerMark(target, "@@heg_equip_forbidden", 0)
-- --       end
-- --       room.logic:trigger("fk.RecoverRegion", target, nil)
-- --     else
-- --       H.askCommandTo(player, target, self.name, true)
-- --     end
-- --   end,
-- -- }

-- -- lihui:addSkill(ziqi)
-- -- lihui:addSkill(xingzhang)
-- -- Fk:loadTranslationTable{
-- --   ["wk_heg__lihui"] = "李恢", --蜀国
-- --   ["wk_heg__ziqi"] = "自器",
-- --   [":wk_heg__ziqi"] = "回合开始时，你恢复所有区域；准备阶段，你可以封锁一个区域，若如此做，直至此回合结束，你对与你势力不同的角色造成伤害后，受伤角色封锁对应的区域。"..
-- --   "<font color = 'gray'>封锁：部分技能拥有封锁区域的效果，被封锁的区域内所有牌的技能无效，但原始牌面信息有效。",
-- --   ["wk_heg__xingzhang"] = "刑张",
-- --   [":wk_heg__xingzhang"] = "锁定技，你攻击范围内的角色：1.恢复区域后，你对其发起强制执行的“军令”；2.成为“军令”的目标结算后，其交给你一张手牌并回复1点体力；3.进入濒死状态被救回后，其恢复一个区域。",

-- --   ["#wk_heg__ziqi_trigger"] = "自器",
-- -- }

-- return extension

-- local buchan = General(extension, "wk_heg__buchan", "wei", 3, 3, General.Male)
-- buchan.subkingdom = "wu"

-- -- local yanjiang = fk.CreateTriggerSkill{
-- --   name = "wk_heg__yanjiang",
-- --   events = {fk.AfterCardsMove, fk.AfterCardTargetDeclared},
-- --   anim_type = "offensive",
-- --   frequency = Skill.Compulsory,
-- --   can_trigger = function (self, event, target, player, data)
-- --     if not player:hasSkill(self) then return false end
-- --     if event == fk.AfterCardTargetDeclared then
-- --       return data.card.trueName == "burning_camps" and data.from
-- --     else
-- --       local cardInfo_discard = {}
-- --       local cardInfo_lose = {}
-- --       for _, move in ipairs(data) do
-- --         if move.toArea == Card.DiscardPile and player.room.current ~= player then
-- --           for _, info in ipairs(move.moveInfo) do
-- --             local card = Fk:getCardById(info.cardId)
-- --             if card.trueName == "burning_camps" then
-- --               table.insert(cardInfo_discard, info.cardId)
-- --             end
-- --           end
-- --         end
-- --         if move.from == player.id and move.moveReason ~= fk.ReasonUse then
-- --           for _, info in ipairs(move.moveInfo) do
-- --             local card = Fk:getCardById(info.cardId)
-- --             if card.trueName == "burning_camps" then
-- --               table.insert(cardInfo_lose, card)
-- --             end
-- --           end
-- --         end
-- --       end
-- --       if #cardInfo_discard > 0 or #cardInfo_lose > 0 then
-- --         self.cost_data = {cardInfo_discard, cardInfo_lose}
-- --         return true
-- --       end
-- --     end
-- --   end,
-- --   on_use = function (self, event, target, player, data)
-- --     local room = player.room
-- --     if event == fk.AfterCardTargetDeclared then
-- --       data.tos = {}
-- --       local user = room:getPlayerById(data.from)
-- --       local user_next = user:getNextAlive()
-- --       local targets = table.filter(room:getAlivePlayers(false), function (p) return H.compareKingdomWith(p, user) or H.compareKingdomWith(p, user_next) end)
-- --       for i = 1, #targets, 1 do
-- --         TargetGroup:pushTargets(data.tos, targets[i].id)
-- --       end
-- --     else
-- --       if #self.cost_data[1] > 0 then
-- --         room:obtainCard(player, self.cost_data[1], true, fk.ReasonJustMove, player.id, self.name)
-- --       end
-- --       if #self.cost_data[2] > 0 then
-- --         for i = 1, #self.cost_data[2], 1 do
-- --           -- room:useVirtualCard()
-- --           local player_next = player:getNextAlive()
-- --           local targets = table.filter(room:getAlivePlayers(false), function (p) return H.compareKingdomWith(p, player) or H.compareKingdomWith(p, player_next) end)
-- --           if not player.dead then
-- --             room:useVirtualCard("burning_camps", nil, player, targets, self.name)
-- --           end
-- --         end
-- --       end
-- --     end
-- --   end,
-- -- }

-- local ruimie = fk.CreateTriggerSkill{
--   name = "wk_heg__ruimie",
--   anim_type = "special",
--   events = {fk.AfterCardsMove, fk.CardUsing, "fk.AfterCommandUse"},
--   can_trigger = function (self, event, target, player, data)
--     if not (player:hasSkill(self)) then return false end
--     if event == fk.AfterCardsMove then
--       local room = player.room
--       local current = room.current
--       if room.current.phase ~= Player.Play then return false end
--       for _, move in ipairs(data) do
--         if move.moveReason == fk.ReasonDiscard and move.toArea == Card.DiscardPile and move.from and move.from == current.id and not room:getPlayerById(move.from).dead then
--           return true
--         end
--       end
--     elseif event == fk.CardUsing then
--       return target:getMark("@@wk_heg__ruimie-turn") > 0 and data.card.trueName == "slash" 
--     else
--       return not data.from.dead
--     end
--   end,
--   on_cost = function (self, event, target, player, data)
--     if event == fk.AfterCardsMove then
--       return player.room:askForSkillInvoke(player, self.name, nil, "wk_heg__ruimie-command")
--     else
--       return true
--     end
--   end,
--   on_use = function (self, event, target, player, data)
--     local room = player.room
--     if event == fk.AfterCardsMove then
--       H.askCommandTo(player, room.current, self.name, true)
--     elseif event == fk.CardUsing then
--       data.nullifiedTargets = table.map(room.alive_players, Util.IdMapper)
--     else
--       room:setPlayerMark(data.from, "@@wk_heg__ruimie-turn", 1)
--     end
--   end,
-- }


-- local yunju = fk.CreateTriggerSkill{
--   name = "wk_heg__yunju",
--   anim_type = "defensive",
--   events = {fk.EnterDying},
--   frequency = Skill.Limited,
--   can_trigger = function (self, event, target, player, data)
--     return player:hasSkill(self) and player == target and player:usedSkillTimes(self.name, Player.HistoryGame) == 0
--   end,
--   on_use = function (self, event, target, player, data)
--     local room = player.room
--     local num = player.maxHp - player.hp
--     room:recover({
--       who = player,
--       num = num,
--       recoverBy = player,
--       skillName = self.name
--     })
--     player:drawCards(num, self.name)
--     room:setPlayerMark(player, "@@wk_heg__yunju", 1)
--   end,
-- }

-- local yunju_delay = fk.CreateTriggerSkill{
--   name = "#wk_heg__yunju_delay",
--   anim_type = "special",
--   events = {fk.DamageInflicted},
--   can_trigger = function (self, event, target, player, data)
--     return player:getMark("@@wk_heg__yunju") == 1 and player == target
--   end,
--   on_cost = Util.TrueFunc,
--   on_use = function (self, event, target, player, data)
--     data.damage = data.damage + 1
--   end,
-- }

-- -- yunju:addRelatedSkill(yunju_delay)
-- -- buchan:addSkill(yunju)
-- -- -- buchan:addSkill(yanjiang)
-- -- buchan:addSkill(ruimie)

-- anim_type = "defensive",
-- events = {fk.TargetConfirmed},
-- can_trigger = function(self, event, target, player, data)
--   local room = player.room
--   if not (player:hasSkill(self) and player == target and data.card.trueName == "slash" and data.from) then return false end
--   local from = room:getPlayerById(data.from)
--   self.cost_data = 0
--   if H.getGeneralsRevealedNum(from) == 2 then
--     self.cost_data = self.cost_data + 1
--   end
--   local events = room.logic:getActualDamageEvents(1, function(e)
--     return e.data[1].from == from and e.data[1].to == player
--   end, Player.HistoryTurn)
--   if #events > 0 then
--     self.cost_data = self.cost_data + 10
--   end 
--   return self.cost_data > 0
-- end,
-- on_use = function(self, event, target, player, data)
--   local room = player.room
--   local from = room:getPlayerById(data.from)
--   if (self.cost_data == 1 or self.cost_data == 11) and room:askForChoice(player, {"wk_heg__juzhan_hide::" .. from.id, "Cancel"}, self.name) ~= "Cancel" then
--     for _, p in ipairs({from}) do
--       local isDeputy = H.doHideGeneral(room, player, p, self.name)
--       room:setPlayerMark(p, "@wk_heg__juzhan_reveal-turn", H.getActualGeneral(p, isDeputy))
--       local record = type(p:getMark(MarkEnum.RevealProhibited .. "-turn")) == "table" and p:getMark(MarkEnum.RevealProhibited .. "-turn") or {}
--       table.insert(record, isDeputy and "d" or "m")
--       room:setPlayerMark(p, MarkEnum.RevealProhibited .. "-turn", record)
--     end
--   end
--   if (self.cost_data == 10 or self.cost_data == 11) and room:askForSkillInvoke(player, self.name, nil, "wk_heg__juzhan_getcard") then
--     local num = player.maxHp - player.hp
--     local card
--     if num ~= 0 then
--       if #from:getCardIds("he") <= num then
--         card = from:getCardIds("he")
--       else
--         card = room:askForCardsChosen(player, from, num, num, "he", self.name)
--       end
--       room:obtainCard(player.id, card, false, fk.ReasonPrey)
--     end
--   end      
-- end,
-- }


-- local lukai = General(extension, "wk_heg__lukai", "wu", 3, 3, General.Male)
-- local kenjie = fk.CreateTriggerSkill{
--   name = "wk_heg__kenjie",
--   anim_type = "defensive",
--   frequency = Skill.Compulsory,
--   events = {fk.AfterCardsMove, fk.BeforeCardsMove},
--   can_trigger = function(self, event, target, player, data)
--     if not player:hasSkill(self) then return false end
--     if event == fk.AfterCardsMove then
--       local cardTo = -99
--       local cardInfo = {}
--       for _, move in ipairs(data) do
--         if move.from and move.from == player.id and move.to and move.to ~= player.id and move.toArea == Card.PlayerHand then
--           for _, info in ipairs(move.moveInfo) do
--             table.insert(cardInfo, info.cardId)
--           end
--           cardTo = move.to
--         end
--       end
--       if #cardInfo > 0 and cardTo ~= -99 then
--         self.cost_data = {cardInfo, cardTo}
--         return true
--       end
--     else
--       local id = 0
--       local source = player
--       local room = player.room
--       local c
--       for _, move in ipairs(data) do
--         if move.to == player.id and move.toArea == Card.PlayerJudge then
--           for _, info in ipairs(move.moveInfo) do
--             id = info.cardId
--             if info.fromArea == Card.PlayerJudge then
--               source = room:getPlayerById(move.from) or player
--             else
--               source = player
--             end
--             c = source:getVirualEquip(id)
--             --FIXME：巨大隐患，延时锦囊的virtual_equips在置入判定区的事件被篡改，或者判定阶段自然流程以外的方式离开判定区时不会清理
--             if not c then c = Fk:getCardById(id) end
--             if c.trueName == "indulgence" or c.trueName == "supply_shortage" or c.trueName == "lightning" then
--               return true
--             end
--           end
--         end
--       end
--     end
--   end,
--   on_use = function(self, event, target, player, data)
--     local room = player.room
--     if event == fk.AfterCardsMove then
--       if #self.cost_data > 0 then
--         local to = room:getPlayerById(self.cost_data[2])
--         room:throwCard(self.cost_data[1], self.name, to, to)
--       end
--     else
--       player:broadcastSkillInvoke(self.name, 1)
--       local source = player
--       local mirror_moves = {}
--       local ids = {}
--       for _, move in ipairs(data) do
--         if move.to == player.id and move.toArea == Card.PlayerJudge then
--           local move_info = {}
--           local mirror_info = {}
--           for _, info in ipairs(move.moveInfo) do
--             local id = info.cardId
--             if info.fromArea == Card.PlayerJudge then
--               source = room:getPlayerById(move.from) or player
--             else
--               source = player
--             end
--             local c = source:getVirualEquip(id)
--             if not c then c = Fk:getCardById(id) end
--             if c.trueName == "indulgence" or c.trueName == "supply_shortage" or c.trueName == "lightning" then
--               table.insert(mirror_info, info)
--               table.insert(ids, id)
--             else
--               table.insert(move_info, info)
--             end
--           end
--           if #mirror_info > 0 then
--             move.moveInfo = move_info
--             local mirror_move = table.clone(move)
--             mirror_move.to = nil
--             mirror_move.toArea = Card.DiscardPile
--             mirror_move.moveInfo = mirror_info
--             table.insert(mirror_moves, mirror_move)
--           end
--         end
--       end
--       table.insertTable(data, mirror_moves)
--     end
--   end,
-- }
-- local bugui = fk.CreateTriggerSkill{
--   name = "wk_heg__bugui",
--   anim_type = "special",
--   events = {fk.EventPhaseEnd},
--   can_trigger = function(self, event, target, player, data)
--     return player:hasSkill(self) and player == target and player.phase == Player.Play and not player:isNude()
--   end,
--   on_use = function(self, event, target, player, data)
--     local room = player.room
--     -- room:askForDiscard(player, 1, 1, false, self.name, false)
    
--     local turn_event_old = room.logic:getCurrentEvent():findParent(GameEvent.Turn, false)
--     if turn_event_old == nil then return false end
--     local end_id_old = turn_event_old.id
--     local cards_old = {}
--     U.getEventsByRule(room, GameEvent.MoveCards, 1, function (e)
--       for _, move in ipairs(e.data) do
--         if move.toArea == Card.DiscardPile then
--           for _, info in ipairs(move.moveInfo) do
--             local card_suit = Fk:getCardById(info.cardId, true).suit
--             if room:getCardArea(info.cardId) == Card.DiscardPile and not table.contains(cards_old, card_suit) and card_suit ~= 0 then
--               table.insertIfNeed(cards_old, card_suit)
--             end
--           end
--         end
--       end
--       return false
--     end, end_id_old)

--     -- local judge_times = math.max(4 - #cards_old, 0)
--     local judge_times = math.max(#cards_old, 0)
--     local i = 0
--     while i < judge_times do
--       local judge = {
--         who = player,
--         reason = self.name,
--         pattern = ".",
--       }
--       room:judge(judge)
--       i = i + 1
--     end
    
--     local turn_event = room.logic:getCurrentEvent():findParent(GameEvent.Turn, false)
--       if turn_event == nil then return false end
--       local end_id = turn_event.id
--       local cards = {}
--       U.getEventsByRule(room, GameEvent.MoveCards, 1, function (e)
--       for _, move in ipairs(e.data) do
--         if move.toArea == Card.DiscardPile then
--           for _, info in ipairs(move.moveInfo) do
--             local card_suit = Fk:getCardById(info.cardId, true).suit
--             if room:getCardArea(info.cardId) == Card.DiscardPile and not table.contains(cards, card_suit) and card_suit ~= 0 then
--               table.insertIfNeed(cards, card_suit)
--             end
--           end
--         end
--       end
--       return false
--     end, end_id)
      
--     if #cards > #cards_old and #cards <= 4 then
--       player:gainAnExtraPhase(Player.Play)
--     end
--   end,
-- }
-- lukai:addSkill(kenjie)
-- lukai:addSkill(bugui)
-- lukai:addCompanions("ld__lukang")
-- Fk:loadTranslationTable{
--   ["wk_heg__lukai"] = "陆凯", --吴国
--   ["designer:wk_heg__lukai"] = "教父&修功",
--   ["wk_heg__kenjie"] = "恳节",
--   [":wk_heg__kenjie"] = "锁定技，其他角色获得你的牌后，弃置之；当你成为延时锦囊牌的目标时，取消之。",
--   ["wk_heg__bugui"] = "卜规",
--   [":wk_heg__bugui"] = "出牌阶段结束时，你可判定X次，若本阶段进入弃牌堆牌的花色数因此增加，你执行一个额外的出牌阶段（X为本回合进入弃牌堆的花色数）。",

--   ["$wk_heg__kenjie1"] = "",
--   ["$wk_heg__kenjie2"] = "",
--   ["$wk_heg__bugui1"] = "",
--   ["$wk_heg__bugui2"] = "",
--   ["~wk_heg__lukai"] = "",
-- }